package com.cmlite.model;

import java.util.ArrayList;
import java.util.List;

import android.util.Log;

public class PeopleModelList extends OutResult{
	private List<PeopleModel> mPeopleEvent;
	public String[] key;
	public String[] lables;

	/**
	 * @return the key
	 */
	public String[] getKey() {
		return key;
	}

	/**
	 * @param key
	 *            the key to set
	 */
	public void setKey(String[] key) {
		this.key = key;
	}

	/**
	 * @return the lables
	 */
	public String[] getLables() {
		return lables;
	}

	/**
	 * @param lables
	 *            the lables to set
	 */
	public void setLables(String[] lables) {
		this.lables = lables;
	}

	public PeopleModelList() {
		mPeopleEvent = new ArrayList<PeopleModel>();
	}

	public PeopleModelList(List<PeopleModel> mPeopleEvent) {
		super();
		this.mPeopleEvent = mPeopleEvent;
	}

	public List<PeopleModel> getmPeopleEvent() {
		return mPeopleEvent;
	}

	public void setmPeopleEvent(List<PeopleModel> mPeopleEvent) {
		this.mPeopleEvent = mPeopleEvent;
	}

	public void addItem(PeopleModel mPeople) {
		this.mPeopleEvent.add(mPeople);
	}

	public void updateItem(PeopleModel mPeople, int position) {
		if (mPeople != null) {
			for (int i = 0; i < mPeopleEvent.size(); i++) {
				if (mPeopleEvent.get(i).getmPeople_ID()
						.equalsIgnoreCase(mPeople.getmPeople_ID())) {
					mPeopleEvent.get(i).setmField_01(mPeople.getmField_01());
					mPeopleEvent.get(i).setmField_02(mPeople.getmField_02());
					mPeopleEvent.get(i).setmField_03(mPeople.getmField_03());
					mPeopleEvent.get(i).setmField_04(mPeople.getmField_04());
					mPeopleEvent.get(i).setmField_05(mPeople.getmField_05());
					return;
				}
			}
		} else {
			Log.d("SON", "Peopel is null");
		}
	}

	public int getCountCheck() {
		int size = 0;
		for (int i = 0; i < mPeopleEvent.size(); i++) {
			if (mPeopleEvent.get(i).isCheck()) {
				size++;
			}
		}
		return size;
	}

	public int getSize() {
		return mPeopleEvent.size();
	}

	@Override
	public String toString() {
		return "PeopleEventList [mPeopleEvent=" + mPeopleEvent + "]";
	}
}
